package com.waves.design.composite;

/**
 * 组合模式
 */
public class CompositeTest {
    public static void main(String[] args) {
        AbstractFile folder1,folder2,folder3;
        folder1 = new FolderFile("文件资料");
        folder2 = new FolderFile("文本文件");
        folder3 = new FolderFile("图片文件");

        AbstractFile file1,file2;
        file1= new TextFile("九阴真经.txt");
        file2= new ImageFile("张三.jpg");

        folder2.add(file1);
        folder3.add(file2);
        folder1.add(folder2);
        folder1.add(folder3);

        folder1.killVirus();
    }
}
